Particle Cloud
Using the same setup as detailed_look.jl or example2(), here we simulate a point cloud getting advected by the flow field. For additional documentation e.g. see : 1, 2, 3, 4
1. Import Software
using IndividualDisplacements, OrdinaryDiffEq, Statistics
p=dirname(pathof(IndividualDisplacements))
include(joinpath(p,"../examples/recipes_plots.jl"))
include(joinpath(p,"../examples/example123.jl"));2. Setup Problem
๐,ฮ=example2_setup()
ii1=5:5:40; ii2=5:5:25
x=vec([x-0.5 for x in ii1, y in ii2])
y=vec([y-0.5 for x in ii1, y in ii2])
xy = permutedims([[x[i];y[i];1.0] for i in eachindex(x)])
solv(prob) = solve(prob,Tsit5(),reltol=1e-6,abstol=1e-6)
tr = DataFrame(ID=Int[], x=Float64[], y=Float64[], t=Float64[])
#๐ผ = Individuals{Float64,2}(๐=xy[:,:], ๐ด=tr, ๐=collect(1:size(xy,2)), ๐ = dxdt!, โซ = solv, ๐ง = postprocess_xy, ๐=๐);I=(position=xy,record=deepcopy(tr),velocity=dxdt!,
integration=solv,postprocessing=postprocess_xy,parameters=๐)
๐ผ=Individuals(I) ๐ details = (1, 40) Array{Float64,1}
๐ด details = (0, 4) ["ID", "x", "y", "t"]
๐ range = (1, 40)
๐ function = dxdt!
โซ function = solv
๐ง function = postprocess_xy
๐ details = (:u0, :u1, :v0, :v1, :๐)
3. Compute Trajectories
๐ = (0.0,2998*3600.0)
โซ!(๐ผ,๐)1ร40 Array{Array{Float64,1},2}:
[6.2601, -11.4048, 1.0] [10.9042, 123.049, 1.0] โฆ [29.8254, 21.0132, 1.0]4. Display results
๐ผ.๐ด.lon=5000*๐ผ.๐ด.x
๐ผ.๐ด.lat=5000*๐ผ.๐ด.y
plt=plot_paths(๐ผ.๐ด,size(xy,2),100000.0)
Compare with trajectory output from MITgcm
#df=read_flt(IndividualDisplacements.flt_example,Float32)
#ref=plot_paths(df,size(xy,2),100000.0)This page was generated using Literate.jl.